/*
    GLScene.cpp

    Created by Miroslav Karpis on 13/11/11.
    Copyright 2011 Miroslav Karpis. All rights reserved.

    This file is part of molecEvol.

    molecEvol is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Foobar is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Foobar.  If not, see <http://www.gnu.org/licenses/>.

 */

#include "GLScene.h"

GLScene::GLScene() {
}

//----------
void GLScene::initGL(){
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glEnable(GL_DEPTH_TEST);
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
}

//----------
void GLScene::redraw(){

	glLoadIdentity();
	
	glColor3f(0,1,0);
	glBegin(GL_TRIANGLES);						// Drawing Using Triangles
	glVertex3f( 0.0f, 1.0f, 0.0f);				// Top
	glVertex3f(-1.0f,-1.0f, 0.0f);				// Bottom Left
	glVertex3f( 1.0f,-1.0f, 0.0f);				// Bottom Right
	glEnd();

	glutSwapBuffers();
}

//----------
void GLScene::reshape(int w, int h) {
	glViewport (0, 0, (GLsizei) w, (GLsizei) h); // set view to ALL
	glMatrixMode (GL_PROJECTION); // use PROJECTION matrix
	glLoadIdentity (); // and load it...
	// set to whole screen
	gluOrtho2D (0.0, (GLfloat) w, 0.0, (GLfloat) h);
}

//----------

